#ifndef MOZG
#define MOZG
#include <fstream>
#include <queue>
#include "sektor.h"
class General;
class MetalMap;
class Prokop;
class baza;
class oddzial;
class sektor;
class jednostka;
class fabrInfo;
class wrogNier;
class mozg
{
public:
//czesci skladowe
	bool arm; //which side (arm/core)
	int druzyna; //team
	bool maNamierzarke; //do we have targetting facility
	General * ge; //pointer to unit managenemt class
	vector<baza> bazy; //vector of bases (main base and abutments)
    IAICallback * cb; //pointer to callback
	int comID; //commander ID
	map<fabrInfo,int> fabryki; //factories (type / how much)
    TTAICore * G; //pointer to main AI class
	gunshipy brawlerowcy; //gunships team
	int ileZwiad; //how many scouts
	noli<jednostka> * je; //our units
	noli<wrogNier> wrogi; //enemy's units, that can't move
	noli<const UnitDef *> * katalog; //units we can build
	huty kombinat; //metal makers
	string kons(string fab); //constructors produced in fab factory
	mordulce oddzialAtk; //our battle troops
	bool posz;
	float3 punktStartu; // "punktStartu" means "startPosition"
	sektor sek[64]; //sectors (every map id divided on 64 sectors with the same size)
	silosiki silosy; //nuclear missles launchers
	zwiadowcy skauci; //scauts
	queue<string> zamowienia; //this is queue, which contains orders for units; this units will be build as soon as possible
	float zaaw; //game progress
//funkcje
	mozg(IAICallback *callback,TTAICore *Gl); //c-tor
	~mozg(); //d-tor
	bool dajNajblizszyProjekt(int id,float dist); //gives closest project (expesive building)
	void dajNr(); //???
	float odlPunktow(float3 a, float3 b, int tryb=0); //distance between two points (tryb=0 - only x and y dimensions, tryb=1 - all dimensions)
	bool budujMexa(budowlancy * bb); //functions builds metal extroctors
	void jednostkaBezrobotna (int id, const UnitDef * def); //unitIdle
	void jednostkaZamordowana (int id, const UnitDef * def); //unit killed
	void jednostkaZrobiona (int id, const UnitDef * def); //unit finished
	jednostka * ktoTo (int id); //return infos about our unit
	int ktorySektor(float3 pos); //returns number of sector with pos point
	int dawajPlamke(int uid); //gives metal spot
	void nowaJednostka (int id, const UnitDef * def); //unit created
	bool ruszZwiadowca (jednostka * zz); //jak zwiadowca, nie mylic z tamtym fotelem!
	void stworzBaze (int sektor, int priorytet, string name); //creates new base
	void hutoCzuwacz(); //turns metal makers on/off
	string wybierzBudynek (budowlancy * nasi); //returns name of building that AI should build
	string wybierzBydynekUMS (budowlancy * nasi);
	string WybierzZaawProj(int unit); //returns name of advanced building that AI should build

};
class fabrInfo //informations about factory
{
public:
	
    TTAICore * G;
	const UnitDef * uuk;
	int id;
	baza * ktoras; 
	fabrInfo(TTAICore * H, int iid);
};
class wrogNier //informations about enemy's buildings that can't move
{
public:
	TTAICore * G;
	IAICallback * cb;
	const UnitDef * wrog;
	int id;
	float3 pos;
};

#endif // MOZG